/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jigdo.data.template;

import java.util.*;
import jigdo.data.template.section.TemplateDESCSection;
import jigdo.data.template.section.TemplateSection;
/**
 *
 * @author John R Sohn
 */
public class JigdoTemplate {
    
    private int countDataEntries=0;
    private int countBZIPEntries=0;
    private int countDESCEntries=0;
    
    public int getCountDataEntries()
    {
        return countDataEntries;
    }
    
    public int getCountBZIPEntries()
    {
        return countBZIPEntries;
    }
    
    public int getCountDescEntries()
    {
        return countDESCEntries;
    }
    
    
    public void AddSection(TemplateSection section) 
    {
        switch( section.SectionType )
        {
            case BZIP:
                this.countBZIPEntries++;
                break;
            case DATA:
                this.countDataEntries++;
                break;
            case DESC:
                this.Description = (TemplateDESCSection)section;
                this.countDESCEntries++;
            break;
                
        }
        
        this.TemplateSections.add(section);
    }
    
    public void FreeData()
    {
        TemplateDataIterator it = this.GetIterator();
        
        while (it.hasNext())
        {
            it.next().UncompressedData = null;
        }
    }
    
    
    public jigdo.data.template.TemplateDataIterator GetIterator()
    {
        return new jigdo.data.template.TemplateDataIterator(this);
    }
    
    public List<TemplateSection> TemplateSections;
    
    public TemplateDESCSection Description;
    
    public String Header;
    
    public JigdoTemplate()
    {
        TemplateSections = new ArrayList<TemplateSection>();
    }
    
}
